package org.grow.jssp;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class JsspApplication {

    public static void main(String[] args) {
        SpringApplication.run(JsspApplication.class, args);

    }
     @Bean
                public MybatisPlusInterceptor mybatisPlusInterceptor(){
                    MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
                    PaginationInnerInterceptor paginationInnerInterceptor
                            = new PaginationInnerInterceptor(DbType.MYSQL);
                    mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
                   mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
                    return mybatisPlusInterceptor;
                }
}
